package com.wzy.level.category.categoryServiceImpl;

import com.wzy.Jdbc封装.pojo.News_category;
import com.wzy.level.byPage.byPageDto.ByPage;
import com.wzy.level.category.categoryDao.categoryDao;
import com.wzy.level.category.categoryDaoImpl.categoryDaoImpl;
import com.wzy.level.category.categoryService.categoryService;

import java.util.ArrayList;
import java.util.List;

public class categoryServiceImpl implements categoryService {
    private categoryDao categoryDao = new categoryDaoImpl();

    @Override
    public List<News_category> selectAll() {

        List<News_category> news_categories = categoryDao.selectAll();
        if (news_categories.size()>0){
            return news_categories;
        }else {
            return new ArrayList<News_category>();
        }
    }

    @Override
    public News_category selectById(int id) {
        return categoryDao.selectById(id);
    }

    @Override
    public List<News_category> selectByPage(ByPage byPage) {
        return categoryDao.selectByPage(byPage);
    }

    @Override
    public int insert(News_category category) {
        return categoryDao.insert(category);
    }

    @Override
    public int update(News_category category) {
        return categoryDao.update(category);
    }

    @Override
    public int deleteById(int id) {
        return categoryDao.deleteById(id);
    }

    @Override
    public int deleteByName(News_category category) {
        return 0;
    }
}
